package com.atguigu.es.demo.bean;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

@Data
//映射类和es中的一个索引
@Document(indexName = "atguigu",shards = 3 , replicas = 2)
//@Document(indexName = "goods",shards = 3 , replicas = 2)
public class Goods {
    @Id  //指定为主键, es自动生成的id是字符串类型的
//    @Field(type = FieldType.Long)
    private String id;
    @Field(type = FieldType.Text , analyzer = "ik_max_word")
    private String title;
    @Field(type = FieldType.Double)
    private Double price;
    @Field(type = FieldType.Keyword , index = false)
    private String images;
    @Field(type = FieldType.Boolean)
    private Boolean salable;
    @Field(type = FieldType.Object)
    private Attr attr;
}
